IF exists(SELECT * FROM dbo.sysobjects WHERE name='R_maandRapportCijfers2PDF' AND xtype='FN') 
BEGIN
	DROP FUNCTION R_maandRapportCijfers2PDF
END
GO

CREATE   function R_maandRapportCijfers2PDF
(@klas varchar(5))
returns table
as
return(
select * from r_maandCijfersVoorRapport
where klas like rtrim(ltrim(@klas)) and not vakcode like 'SE'
                     and not( vakcode like 'ES')
                      and not( vakcode like 'KV')
)